//
//  BaseTableViewController.swift
//  微博(swfit)
//
//  Created by YLW on 15/9/21.
//  Copyright © 2015年 YLW. All rights reserved.
//

import UIKit

class BaseTableViewController: UITableViewController {
    
    var userLogin = false
    var visitorView : VisitorView?
    
    override func loadView() {
        userLogin ? super.loadView() : setVisitorView()
        
    }

    override func viewDidLoad() {
        super.viewDidLoad()
        
        visitorView?.registerBtn.addTarget(self, action: "visitorViewDidRegister", forControlEvents: UIControlEvents.TouchUpInside)
        visitorView?.loginBtn.addTarget(self, action: "visitorViewDidlogin", forControlEvents: UIControlEvents.TouchUpInside)
        
    }
    
    private func setVisitorView()
    {
        visitorView = VisitorView()
        view = visitorView
        
        navigationItem.leftBarButtonItem = UIBarButtonItem(title: "注册", style: UIBarButtonItemStyle.Plain, target: self, action: "visitorViewDidRegister")
        navigationItem.leftBarButtonItem?.tintColor = UIColor.orangeColor()
        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "登录", style: UIBarButtonItemStyle.Plain, target: self, action: "visitorViewDidlogin")
        navigationItem.rightBarButtonItem?.tintColor = UIColor.orangeColor()
    }
    
//    @objc private func visitorViewDidRegister()
//    {
//        
//    }
//    
//    @objc private func visitorViewDidLogin()
//    {
//        
//    }
    
    @objc private func visitorViewDidlogin() {
        print("登录")
    }
    
    @objc private func visitorViewDidRegister() {
        print("注册")

    }

}
